package com.java2207.group1.controller;

import com.java2207.group1.common.LayuiUserVo;
import com.java2207.group1.common.R;
import com.java2207.group1.pojo.User;
import com.java2207.group1.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Lenovo 2022/7/27 12:03
 *
 */
@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    UserService userService;

    @RequestMapping("/login")
    public LayuiUserVo login(User user){
        LayuiUserVo currentUser = userService.login(user);

       if (currentUser.getData() != null){
           return currentUser;
       }else {
           LayuiUserVo layuiUserVo = new LayuiUserVo();
           layuiUserVo.setCode(444);
           return layuiUserVo;
       }

    }
}
